import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";
import { ReqPage, ResPage } from "../interface";

/**
 * @name 分页查询角色
 */
export const getUserList = () => {
  return http.get<User.ResUser>(PORT1 + `/system/sys-user/list`);
};
export const page = (params: User.ReqUser) => {
  return http.get<ResPage<User.ResUser>>(PORT1 + `/system/sys-user/page`, params);
};
export const saveUser = (params: User.ReqUser) => {
  return http.post<ResPage<User.ResUser>>(PORT1 + `/system/sys-user/save`, params);
};
export const updateUser = (params: User.ReqUser) => {
  return http.post<ResPage<User.ResUser>>(PORT1 + `/system/sys-user/update`, params);
};
export const detail = (id: number) => {
  return http.get<User.ResUser>(PORT1 + `/system/sys-user/get/${id}`);
};
export namespace User {
  export interface ResUser {
    id: number;
    avatar: string;
    userName: string;
    password: string;
    deptId: number;
    roleIds: Array<String>;
    status: number;
    phone: number;
    email: string;
    nickName: number;
    sex: number;
    createBy: number;
    createTime: Date;
    updateBy: number;
    updateTime: Date;
    isDeleted: number;
  }
  export interface ReqUser extends ReqPage {
    id: number;
    avatar: string;
    userName: string;
    password: string;
    phone: number;
    deptId: number;
    roleIds: Array<String>;
    status: number;
    email: string;
    nickName: number;
    sex: number;
    createBy: number;
    createTime: Date;
    updateBy: number;
    updateTime: Date;
    isDeleted: number;
  }
}
